package model.shelves;

import java.util.Iterator;
import java.util.Observable;
import java.util.Observer;

import javax.naming.OperationNotSupportedException;

import model.rentals.Rental;

/**
 * Classe Abstracta Shelf
 * @author DCO37
 * 	N.º 42484 Helder Ferreira
 *  N.º 45509 Luis Ferreira
 */
public abstract class Shelf extends Observable implements IShelf{
	// name da Shelf
	String name;
	
	/**
	 * Construtor de uma Shelf dado um name
	 * @param name - nome da Shelf
	 */
	public Shelf(String name) {
		this.name = name;
	}

	/**
	 * Iterador de lista de rentals
	 */
	@Override
	public abstract Iterator<Rental> iterator();

	/**
	 * Comparador de Shelves
	 */
	@Override
	public int compareTo(IShelf arg0) {
		return arg0.getName().compareTo(name);
	}

	/**
	 * Devolve name da Shelf
	 */
	@Override
	public String getName() {
		return this.name;
	}

	/**
	 * @throws OperationNotSupportedException 
	 * Adiciona um rental a lista de rentals
	 */
	@Override
	public abstract boolean addRental(Rental rental) 
			throws OperationNotSupportedException;

	/**
	 * @throws OperationNotSupportedException 
	 * Remove um rental a lista de rentals
	 */
	@Override
	public abstract boolean removeRental(Rental rental) 
			throws OperationNotSupportedException;
}
